<%--
 *  File:    UserChangePrivlist.jsp
 *  @Author: carolinewu
 *  Date:   2004-8-03
 *
 *  Copyright (C) 2000 - 2004 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  Category cat = Category.getInstance("jsp.UserChangePrivlist");
	String strModuleName = "UPM";
  String strTableName = "ovuserchangeprivlist";
  String privilegeCode = "Z0204";
  
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<PageFlow:CheckPageFlow pageName="userchangeprivlistsummary"/>
<title>UserChangePrivlist</title>
<%@ include file="/inc/SumDiv.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<%@ include file="/inc/NewCalendar.inc" %>
<script language="JavaScript" src="../../js/SummaryDivision.js"></script>
<script language="JavaScript">

function page_summary(actionvalue,orderbyname)
{
  if(!formatDate(document.thisform))return;
  var editform = summaryPrepare(document.thisform, actionvalue, orderbyname);
  if (editform == false)
      return;
  editform.action = "UserChangePrivlist.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_delete()
{
   if(!formatDate(document.thisform))return;
   var checkinfo = false;
    var eles = thisform.elements;
    for (var i=0;i<eles.length;i++)
      if (eles[i].name=="changeprivlists"&&eles[i].checked==true)
        checkinfo = true;
    if (!checkinfo)
    {
      alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
      return;
    }
  	var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  	if(!flag)
    	return;
  	thisform.actionname.value = "delete";
  	thisform.target = "_self";
  	isRunning = true;
  	thisform.submit();
}

function page_selectall()
{
  if (Number(document.thisform.summarysize.value) == 0)
  {
    return;
  }
  if (Number(document.thisform.summarysize.value) == 1)
  {
     document.thisform.changeprivlists.checked=true;
     return;
  }
  for (var i = 0; i<Number(document.thisform.summarysize.value);i++)
  {
      document.thisform.changeprivlists[i].checked=true;
  }
}

</script>
</head>
<body>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="thisform" method="post" action="../../Dispatcher"  target="_self">
    <input type="hidden" name="pagename" value="userchangeprivlistsummary">
    <input type="hidden" name="actionname">
    
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" colspan="2" ></td>
        </tr>  
        <tr >      
        <td colspan="10"><%=label.getLabelName("L_QueryScope")+label.getLabelName("L_Colon")%>
                  
                  <%
                    String strDate = ((pageContext.getAttribute("changeddatetime1")==null)
                 			   	? OvalTools.dateToString(new java.sql.Date(System.currentTimeMillis()), (String)session.getAttribute("dateformat"))
                 			   	:(OvalTools.dateToString((java.sql.Date)pageContext.getAttribute("changeddatetime1"),(String)session.getAttribute("dateformat"))));
                    String strEndDate = ((pageContext.getAttribute("changeddatetime2")==null)
                 			   	? OvalTools.dateToString(new java.sql.Date(System.currentTimeMillis()), (String)session.getAttribute("dateformat"))
                 			   	:(OvalTools.dateToString((java.sql.Date)pageContext.getAttribute("changeddatetime2"),(String)session.getAttribute("dateformat"))));
            
                   %>
                      <custom:text  property="changeddatetime1" dataType="date"   dataFormatName="dateformat" module="COM" label="L_QueryScope" command="notnull" size="10" value="<%=strDate%>"/>
                      <a onclick="javascript:c.show(this,'thisform.changeddatetime1','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a> 
                      -
                      <custom:text  property="changeddatetime2" dataType="date"   dataFormatName="dateformat" module="COM" label="L_QueryScope" command="notnull" size="10" value="<%=strEndDate%>"/>
                      <a onclick="javascript:c.show(this,'thisform.changeddatetime2','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a> 
         </td>
        
        </tr>
        <%@ include file="/inc/SummarySearch.inc" %>  
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center" width="100%">

        <tr class="deepblue-left">         
          <td width="26" class="title_center">&nbsp;<a href="javascript:page_selectall()"><%= label.getLabelName("L_SelectAll")%></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','userchangeprivlistid');"><%= label.getLabelName("L_ChangeCode") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','orgcode');"><%= label.getLabelName("L_AdminOrgcode") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','orgname');"><%= label.getLabelName("L_AdminOrgName") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','adminusercode');"><%= label.getLabelName("L_AdminUserCode") %></a></td>
          <td class="title_center" width="120"><a href="javascript:page_summary('orderby','adminusername');"><%= label.getLabelName("L_AdminUserName") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','targettype');"><%= label.getLabelName("L_TargetType") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','targetorgcode');"><%= label.getLabelName("L_TargetOrgcode") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','targetorgname');"><%= label.getLabelName("L_TargetOrgName") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','targetcode');"><%= label.getLabelName("L_TargetCode") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','targetname');"><%= label.getLabelName("L_TargetName") %></a></td>          
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','privlistcode');"><%= label.getLabelName("L_ChangedPrivlistCode") %></a></td>          
          <td class="title_center" ><a href="javascript:page_summary('orderby','privlistname');"><%= label.getLabelName("L_ChangedPrivlistName") %></a></td>         
          <td class="title_center" width="40"><a href="javascript:page_summary('orderby','changaction');"><%= label.getLabelName("L_ChangedAction") %></a></td>         
          <td class="title_center" width="120"><a href="javascript:page_summary('orderby','changeddatetime');"><%= label.getLabelName("L_ChangedDate") %></a></td>         
        </tr>
        <%
          int i=0;
          String strClassType="none";
          Integer oDefaultId=null;          
          Integer oDefaultStatus=null;        
          boolean blHashChecked=false;
          String strChecked="";

          Vector changeprivlist=(Vector)pageContext.getAttribute("changeprivlist");
          if(changeprivlist==null)
            changeprivlist=new Vector();
        %>
        <logic:iterate id="changeprivlistitem" collection="<%= changeprivlist %>">
        <%
          HashMap hashTmp=(HashMap)pageContext.getAttribute("changeprivlistitem");
         
          if(hashTmp==null)
            hashTmp=new HashMap();
          if(i%2==0)
          {
            strClassType="td-listrom";
          }
          else
          {
            strClassType="none";
          }
          i++;
        
        %>
        <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"   class="<%=JspHelper.filterNull(strClassType)%>">
          <td width="5">
              		<input type="checkbox" name="changeprivlists" value="<%=JspHelper.filterNull( hashTmp.get("userchangeprivlistid") )%>" class="checkbox">
         </td>         
          <td >&nbsp;<custom:write name="changeprivlistitem" property="userchangeprivlistid"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="orgcode"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="orgname"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="adminusercode"/></td>
          <td>&nbsp;<custom:write name="changeprivlistitem" property="adminusername"  /></td>
          <td>&nbsp;<custom:write name="changeprivlistitem" property="targettype"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="targetorgcode"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="targetorgname"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem"  property="targetcode"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="targetname"/></td>
          <td >&nbsp;<custom:write name="changeprivlistitem" property="privlistcode"/></td>
          <td>&nbsp;<custom:write name="changeprivlistitem" property="privlistname"/></td>
          <td>&nbsp;<custom:write name="changeprivlistitem" property="changaction"/></td>
          <td>&nbsp;<%= OvalTools.dateToString((java.sql.Date)hashTmp.get("changeddatetime"),(String)session.getAttribute("dateformat")+" HH:mm:ss") %></td>
        </tr>
        </logic:iterate>
        
        <%@ include file="/inc/SummaryAction.inc" %>

      </table>
    </td>
  </tr>
  <tr>
    <td class="summary_top">
     <input name="summarysize" type="hidden" value="<%=JspHelper.filterNull( changeprivlist.size())%>"></td>
  </tr>
  <tr>
     <td class="td_center">		  
		   <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
		 </td>
        </tr>
</form>
</table>
</body>
<%@ include file="/inc/AlertError.inc" %>  
</html>


